@extends('admin.layouts.app')
@section('css')
<link href="/admins/css/user/user.css" rel="stylesheet">
@endsection
@inject('roleuser','App\Repositories\Presenter\RoleUserPresenter')
@section('content')
<div class="">
	<div class="page-title">
		<div class="title_left">
			<h3>用户管理</h3>
		</div>
	</div>

	<div class="clearfix"></div>
	<div class="row">
		<div class="col-md-12 col-sm-12 col-xs-12">
			<div class="x_panel">
				<div class="x_title">
					<h2>编辑用户</h2>
					<div class="clearfix"></div>
				</div>
				<div class="x_content">
					<br />
					<form class="form-horizontal form-label-left" action="{{route('user.update',['id'=>$user['id']])}}" method="post">
						{{ csrf_field() }}
						{{ method_field('PATCH') }}
						<input type="hidden" name="id" value="{{$user['id']}}"/>
						<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">用户名<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="text" name="username" class="form-control" value="{{old('username')?old('username'):$user['username']}}">
								@if ($errors->has('username'))
								<span class="help-block"> <strong>{{ $errors->first('username') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">名称<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="text" name="name" class="form-control" value="{{old('name')?old('name'):$user['name']}}">
								@if ($errors->has('name'))
								<span class="help-block"> <strong>{{ $errors->first('name') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">邮箱<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="text" name="email" class="form-control" value="{{old('email')?old('email'):$user['email']}}">
								@if ($errors->has('email'))
								<span class="help-block"> <strong>{{ $errors->first('email') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">超级管理员</label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<div class="checkbox">
                            			<label class="">
                            				<div class="icheckbox_flat-green" style="position: relative;">
                            					<input type="checkbox" class="flat" style="position: absolute; opacity: 0;" name="is_super" {{$user['is_super']?'checked':''}}/>
                            						<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                        						</div> 超级管理员
                            			</label>
                        			</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">角色</label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								@foreach ($roles as $role)
								    <label class="checkbox inline">
										<input value="{!!$role['id']!!}" type="checkbox" name="role_id[]" {!! $roleuser->hasRole($roleusers,$role['id'])?"checked":"" !!}>{!!$role['display_name']!!}
									</label>
								@endforeach
							</div>
						</div>
						<div class="ln_solid"></div>
						<div class="form-group">
							<div class="col-xs-12 text-center">
								<button type="submit" class="btn btn-success">
								提交
								</button>
							</div>
						</div>

					</form>
				</div>
			</div>
		</div>
	</div>
</div>
@endsection

@section('js')

@endsection
